/**
 * @description: get value
 * @param {type: String}
 * @return: [Object,String,null]
 */
function getLocalStorage(key) {
    let storageData = localStorage.getItem(key);
    if (storageData) {
        let storage;
        try {
            storage = JSON.parse(storageData);
        }
        catch (err) {
            storage = storageData;
        }
        return storage;
    }
    return storageData;
}
/**
 * @description: set value
 * @param {[key,data]}
 * @return:void
 */
function setLocalStorage(key, data) {
    typeof data === "string" ? localStorage.setItem(key, data) : localStorage.setItem(key, JSON.stringify(data));
}
/**
 * @description: remove
 * @param { arguments }
 * @return: [Array,undefined]
 */
function removeLocalStorageKey(...args) {
    let errArgs = [];
    args.forEach((item) => {
        typeof item === "string" ? localStorage.removeItem(item) : errArgs.push(item);
    });
    return errArgs.length ? { errMsg: "error param", errKey: errArgs } : undefined;
}

export { getLocalStorage, removeLocalStorageKey, setLocalStorage };
